<template>
  <div v-if="!isLoginOrRegister">
    <Header />
  </div>
  <router-view />
  <div v-if="!isLoginOrRegister">
    <Footer />
  </div>
</template>

<script setup>
import { ref, onBeforeMount, watch} from 'vue';
import { useRoute } from 'vue-router';
import Header from './components/Header.vue';
import Footer from './components/Footer.vue';

const route = useRoute();
const isLoginOrRegister = ref(false);

onBeforeMount(() => {
  checkRoute();
});

const checkRoute = () => {
  isLoginOrRegister.value = route.name === 'Login' || route.name === 'Register';
};

// 监听路由变化
watch(
    () => route.path,
    () => {
      checkRoute();
    }
);
</script>

<style>
/* 样式 */
</style>



